<div class="admin-submenu">
    <div style="width: 100%; height: 100%">

        <div class="submenu-scene">
            系统设置
        </div>

        <div class="submenu-item">系统设置</div>

        <ul>
            <li><a href="/setting"> 系统设置</a></li>
        </ul>

        <div id="admin-submenu-c">
            <i class="layui-icon layui-icon-prev"></i>
        </div>

    </div>

</div>

<div class="admin-content">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-md12">

            <div class="adminpageheader">
                <h2 class="adminpagetitle">当前位置：<a href="">配置中心</a></h2>
            </div>

            <div class="admin-block">
                <div class="block">

                    <div class="block-tab">
                        <div class="layui-tab layui-tab-brief" lay-filter="settingtab">
                            <ul class="layui-tab-title">
                                <li class="layui-this">网站设置</li>
                                <li>个人配置</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <div class="block-body">
                                        <div class="block-table">
                                            <div class="layui-row">
                                                <div class="layui-col-md2">
                                                    <div class="layui-form-group">基础设置</div>
                                                </div>
                                                <div class="layui-col-md10">
                                                    <form class="layui-form" action="" lay-filter="setting">

                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>网站名称：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="text" name="WebTitle"
                                                                           lay-verify="required" placeholder=""
                                                                           autocomplete="off" class="layui-input"
                                                                           value="{{.config.WebTitle}}">
                                                                    <div class="input-tip">全站显示Title位置</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>网站关键字：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="text" name="Keywords"
                                                                           lay-verify="required" placeholder="请输入关键字"
                                                                           autocomplete="off" class="layui-input"
                                                                           value="{{.config.Keywords}}">
                                                                    <div class="input-tip">请使用英文逗号分开</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>网站URL：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="text" name="WebUrl"
                                                                           lay-verify="required" placeholder="请输入关键字"
                                                                           autocomplete="off" class="layui-input"
                                                                           value="{{.config.WebUrl}}">
                                                                    <div class="input-tip">请使用英文逗号分开</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>首页显示条目：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="text" name="PageSize"
                                                                           lay-verify="required" placeholder="请输入关键字"
                                                                           autocomplete="off" class="layui-input"
                                                                           value="{{.config.PageSize}}">
                                                                    <div class="input-tip">输入每一页显示的数量</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>网站描述：</label>
                                                                <div class="layui-input-block">
                                                                    <textarea name="Description" placeholder=""
                                                                              class="layui-textarea">{{.config.Description}}</textarea>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>选择主题：</label>
                                                                <div class="layui-input-block">
                                                                    <select name="Theme" lay-verify="">
                                                                        <option value="default" selected>默认</option>
                                                                        <option value="leo">leo</option>
                                                                        <option value="xbs4">bootstrap4</option>
                                                                        <option value="xianyan">闲言</option>
                                                                    </select>
                                                                    <div class="input-tip">重新编译程序后生效</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label">站点状态：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="checkbox" name="status"
                                                                           lay-skin="switch" lay-text="已运行|已关闭"
                                                                           value="1" checked>
                                                                    <div class="input-tip">启用起来就很完美</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-form-item">
                                                            <div class="layui-input-block">
                                                                <button class="layui-btn" lay-submit
                                                                        lay-filter="site">立即提交
                                                                </button>
                                                                <button type="reset"
                                                                        class="layui-btn layui-btn-primary">重置
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div class="block-body">
                                        <div class="block-table">
                                            <div class="layui-row">
                                                <div class="layui-col-md2">
                                                    <div class="layui-form-group">个人信息设置</div>
                                                </div>
                                                <div class="layui-col-md10">
                                                    <form class="layui-form" action="" lay-filter="setting">

                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>用户名：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="text" name="username"
                                                                           lay-verify="required"
                                                                           autocomplete="off" class="layui-input"
                                                                           value="{{.config.Author}}">
                                                                    <div class="input-tip">登陆账号</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-row  layui-form-item">
                                                            <div class="layui-col-md12">
                                                                <label class="layui-form-label"><span
                                                                        class="text-red">*</span>密码：</label>
                                                                <div class="layui-input-block">
                                                                    <input type="password" name="password"
                                                                           lay-verify="required"
                                                                           autocomplete="off" class="layui-input"
                                                                           value="{{.config.Password}}">
                                                                    <div class="input-tip">登陆密钥</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-form-item">
                                                            <div class="layui-input-block">
                                                                <button class="layui-btn" lay-submit
                                                                        lay-filter="user">保存
                                                                </button>
                                                                <button type="reset"
                                                                        class="layui-btn layui-btn-primary">重置
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                </div>

            </div>


        </div>

    </div>
</div>
<script type="text/javascript">
    layui.use(['form'], function () {
        // 操作对象
        var $ = layui.jquery
                , layer = layui.layer
                , form = layui.form;
        form.on('submit(user)', function (data) {
            data.field.submit = "user";
            $.post("/api/site/config", data.field, function (res) {
                if (res.Error === 0) {
                    layer.open({
                        title: res.Title
                        , content: res.Msg,
                        yes: function (index) {
                            window.location.href = "/setting";
                            layer.close(index); //如果设定了yes回调，需进行手工关闭
                        }
                    });
                } else {
                    layer.msg(res.Title + res.Msg, {time: 2000});
                }
            }, "json");
            return false;
        });
        form.on('submit(site)', function (data) {
            data.field.submit = "site";
            $.post("/api/site/config", data.field, function (res) {
                if (res.Error === 0) {
                    layer.open({
                        title: res.Title
                        , content: res.Msg,
                        yes: function (index) {
                            window.location.href = "/setting";
                            layer.close(index); //如果设定了yes回调，需进行手工关闭
                        }
                    });
                } else {
                    layer.msg(res.Title + res.Msg, {time: 2000});
                }
            }, "json");
            return false;
        });
    });
</script>